<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.1.js"></script>
<script type="text/javascript">
	function registerMessage() {
		var frm = document.writeForm;
		
		if(frm.message_reciever.value == "")
			alert("받는이를 입력해 주세요!");
		if(frm.message_content.value == "")
			alert("내용을 입력해 주세요!");
		var i = confirm("쪽지를 보내시겠습니까?");
		if(i){
			frm.submit();
			self.close();
		}
	}
	function cancelWriting(){
		self.close();
	}
</script>
</head>
<body>
<c:if test="${ sessionScope.userVo!=null || sessionScope.adminVo!=null}">
<form action="/OffTheRecord/writeMessage.action" name="writeForm" method="post">
<select name="messageTypeNum">
	<c:forEach items="${mtList }" var="mtvo">
		<option value="${mtvo.messageTypeNum }">${mtvo.messageTypeNum }</option>
	</c:forEach>
</select>
받는이 <input type="text" name="messageReceiver" id="message_reciever"><p>
내용 <br>
<textarea rows="15" cols="40" name="messageContent" id="message_content"></textarea><p>

<input type="button" value="확인" onclick="registerMessage()">
<input type="button" value="취소" onclick="cancelWriting()">
</form>
</c:if>
</body>
</html>